
using System;
public class ISingleton
{

}

public class Singleton<T> : ISingleton where T : ISingleton, new()
{
    private static T _instance;
    public static T Instance
    {
        get
        {
            if (Singleton<T>._instance == null)
            {
                Singleton<T>._instance = new T();
            }
            return Singleton<T>._instance;
        }
    }

    public virtual void Dispose()
    {
        _instance = null;
    }
}